package com.test.designPattern.behaviorType.commandPattern;

import java.util.ArrayList;
import java.util.List;

/**
 * 服务员
 *
 * @author wangjie
 * @version V1.0
 * @date 2020/4/8
 */
public class Waiter {

    private List<Command> orders = new ArrayList<>();

    /**
     * 点菜
     * @param command
     */
    public void setOrder(Command command){
        orders.add(command);
    }

    /**
     * 撤销点的菜
     * @param command
     */
    public  void  CancelOrder(Command command){
        orders.remove(command);
    }

    /**
     * 通知后厨做菜
     */
    public  void notifyCook(){
        for (Command command : orders){
            command.excute();
        }
    }

}
